﻿using INTEX.DataBase;
using ReflectionStudio.Components.UserControls;
using ReflectionStudio.Core;
using ReflectionStudio.Core.Events;
using ReflectionStudio.Core.Helpers;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OracleClient;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using WPFExcelReport.Helpers;
using ReflectionStudio.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WPFExcelReport
{
    public partial class YCAFSAV95DOC
    {
        int colLast;
        private void cmdToggleAll(object sender, RoutedEventArgs e)
        {
            int idx = 1;
            colLast = 0;
            while (true)
            {
                DataGridTemplateColumn colA = (DataGridTemplateColumn)this.FindName("col" + idx);
                if (colA != null)
                {
                    colA.Visibility = System.Windows.Visibility.Visible;
                    idx++;
                }
                else
                {
                    break;
                }
            }
        }

        private void cmdShowLast(object sender, RoutedEventArgs e)
        {
            DataGridTemplateColumn colA = (DataGridTemplateColumn)this.FindName("col" + colLast);
            if (colA != null)
                colA.Visibility = System.Windows.Visibility.Visible;
        }
        private void cmdHideNext(object sender, RoutedEventArgs e)
        {
            int idx = colLast;
            while (idx <= colLast + Convert.ToInt16(nextN.Text))
            {
                DataGridTemplateColumn colA = (DataGridTemplateColumn)this.FindName("col" + idx);
                if (colA != null)
                {
                    colA.Visibility = System.Windows.Visibility.Hidden;
                    idx++;
                }
                else
                {
                    break;
                }
            }
            colLast += Convert.ToInt16(nextN.Text);
            nextN.Text = "1";
        }
        private void colShowHide(object sender, RoutedEventArgs e)
        {
            CheckBox tb = sender as CheckBox;
            string idx = tb.Name.ToString().Replace("Toggle", "");
            DataGridTemplateColumn colA = (DataGridTemplateColumn)this.FindName("col" + idx);
            if (colA != null)
            {
                colA.Visibility = colA.Visibility == System.Windows.Visibility.Visible ? System.Windows.Visibility.Hidden : System.Windows.Visibility.Visible;
            }
            colLast = Convert.ToInt16(idx);
        }         
    }
}
